<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- <button @click="changeInfo">change</button> -->
        <button @click="handler">handler</button>
        <ul>
            <li v-for="value,key in studentInfo" :key="item">{{key}}--{{value}}</li>
        </ul>
    </div>
    <script>
        Vue.config.productionTip = false;
        
        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    studentInfo: {
                        name: 'zhangsan',
                        age: 18,
                        sex: '男',
                        score: {
                            math: 80,
                            eng: 90
                        }
                    }
                }
            },
            methods: {
                // changeInfo() {
                //     this.studentInfo.name = '王俊凯'//改
                //     this.studentInfo.like1 = '篮球'
                //     delete this.studentInfo.sex;
                // },
                handler() {
                    this.studentInfo.name = '王俊凯'//改
                    this.studentInfo.like1 = '篮球'//增加
                
                    // this.$set(this.studentInfo, 'like', '足球');
                    // Vue.set(this.studentInfo, 'food', '橘子');

                    // Vue.delete(this.studentInfo, 'sex');
                    // this.$delete(this.studentInfo, 'sex');


                }
            },
        })
</script>
</body>

</html>